#!/bin/bash


source /CORE/CAD/arm-dev/aarch-gcc/gcc-linaro-7.2.1-2017.11-x86_64_aarch64-elf/env.bashrc
export CC_FOR_TARGET='aarch64-elf-gcc -mstrict-align'

BOOT_ROOT=`pwd`
INSTALL_DIR=$BOOT_ROOT/runtime/newlib
mkdir -p $INSTALL_DIR

newlib_ver=newlib-3.0.0.20180226
mkdir tmp
cd tmp
rm ${newlib_ver}* -rf

set -e 
wget ftp://202.197.154.250/soft/openSource/newlib/$newlib_ver.tar.gz
tar -xvf /home/slp/up/$newlib_ver.tar.gz
cd $newlib_ver
./configure --prefix=$INSTALL_DIR --with-newlib --target=aarch64-elf --disable-multilib	
make -j7
make install

cd $BOOT_ROOT/tmp
rm $newlib_ver -rf

